<template>
    <div>
        <el-table
        :data="tableData"
        style="width: 100%">
            <el-table-column
                prop="id"
                label="ID"
                width="60">
            </el-table-column>
            <el-table-column
                prop="shopname"
                label="ShopName"
                width="150">
            </el-table-column>
            <el-table-column
                prop="boss"
                label="Boss"
                width="100">
            </el-table-column>
            <el-table-column
                prop="address"
                label="Address"
                width="180">
            </el-table-column>
            <el-table-column
                prop="email"
                label="Email"
                width="250">
            </el-table-column>
            <el-table-column
                prop="status"
                label="Status"
                width="100">
            </el-table-column>
            <el-table-column
                prop="createdate"
                label="CreateDate"
                width="180">
            </el-table-column>
            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button
                    size="mini"
                    type="success"
                    style="margin-left:10px"
                    @click="handleAccept(scope.row)">通过</el-button>

                    <el-button
                    size="mini"
                    type="danger"
                    style="margin-left:10px"
                    @click="handleDelete(scope.row)">不通过</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
export default {
    name: "shopcheck",
    data() {
      return {
        activeName: 'first',
        tableData: [],
        formLabelWidth: '120px'
      };
    },
    methods: {
        handleDelete(row) {
            this.$axios.post("/api/updateShopStatus",this.$querystring.stringify({
            id:row.id,
            status: 'no'
            })).then(reponse=>{
            console.log(reponse);
            if(reponse.data == true){

               alert("不通过成功")
            }else{
                alert("系统错误")
            }
        })
      },
      handleAccept(row){
            this.$axios.post("/api/updateShopStatus",this.$querystring.stringify({
            id:row.id,
            status: 'ok'
            })).then(reponse=>{
            console.log(reponse);
            if(reponse.data == true){
                /*
                成功跳转
                */
               alert("通过成功")
            }else{
                alert("系统错误")
            }
        })
      }
    },
    mounted(){
        if(this.$cookies.get("shopcheck_second") != 'ok'){
            alert("无权限");
            this.$router.push("/adminindex")
        }else{
            this.$axios.get("/api/getCheckShop").then(res=>{
                this.tableData = res.data
            });
        }
    }
}
</script>

<style scoped>

</style>